﻿<%@ Page Title="Pedidos" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Kakaroto.Pedidos.Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <div class="input-group">
      <span class="input-group-btn">
           <asp:Button ID="SearchButton" Text="Filtrar: " runat="server" OnClick="SearchButton_Click" CssClass="btn btn-default" />
      </span>
      <input id="Search" runat="server" placeholder="Mesa" type="text" class="form-control">
    </div>
    <br />
    <br />
     
    <p><a class="btn btn-success btn-large" href="./ListaMesas.aspx" role="button" style="width:150px">Novo Pedido</a></p>
    
    <asp:UpdatePanel ID="up" runat="server">
        <ContentTemplate>
            <asp:Timer ID="Timer1" Interval="1000" runat="server" OnTick="Timer1_Tick"></asp:Timer>
                <div>
                    <asp:ListView id="ListaPedidosAtivos" runat="server"
                        DataKeyNames="Id" 
			            ItemType="Kakaroto.Models.Pedido"
                        SelectMethod="GetPedidos">
                        <EmptyDataTemplate>
                            <div class="alert alert-danger" role="alert">
                                    Nenhum pedido encontrado...
                             </div>
                        </EmptyDataTemplate>
                        <LayoutTemplate>
                            <table class="table">
                                <thead>
                                    <tr>
                                        <th>
								            <asp:LinkButton Text="Mesa" CommandName="Sort" CommandArgument="Id_Mesa" runat="Server" />
							            </th>
                                        <th>
								            <asp:LinkButton Text="Cliente" CommandName="Sort" CommandArgument="Cliente_Nome" runat="Server" />
							            </th>
                                        <th>
								            <asp:LinkButton Text="Total (R$)" CommandName="Sort" CommandArgument="Total" runat="Server" />
							            </th>
                                        <th>&nbsp;</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr runat="server" id="itemPlaceholder" />
                                </tbody>
                            </table>
				            <asp:DataPager PageSize="10"  runat="server">
					            <Fields>
                                    <asp:NextPreviousPagerField ShowLastPageButton="False" ShowNextPageButton="False" ButtonType="Button" ButtonCssClass="btn" PreviousPageText="Anterior"/>
                                    <asp:NumericPagerField ButtonType="Button"  NumericButtonCssClass="btn" CurrentPageLabelCssClass="btn disabled" NextPreviousButtonCssClass="btn" />
                                    <asp:NextPreviousPagerField ShowFirstPageButton="False" ShowPreviousPageButton="False" ButtonType="Button" ButtonCssClass="btn" NextPageText="Próxima" />
                                </Fields>
				            </asp:DataPager>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <tr>
							
							            <td>
								            <asp:DynamicControl runat="server" DataField="Id_Mesa" ID="Mesa" Mode="ReadOnly" />
							            </td>
                                        <td>
								            <asp:DynamicControl runat="server" DataField="Cliente_Nome" ID="Cliente_Nome" Mode="ReadOnly" />
							            </td>
                                        <td>
								            <asp:DynamicControl runat="server" DataField="Total" ID="Total" Mode="ReadOnly" />
							            </td>
                                        
                                        <td>
					                        <asp:Button ID="AlterarPedido" runat="server" Text="Alterar" CommandName="AltPed" CommandArgument='<%#:Item.Id %>' OnClick="AlteraBtn_Click" class="btn btn-primary" />
                                        </td>
                            </tr>
                        </ItemTemplate>
                    </asp:ListView>
                </div>
            </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
